<?php
namespace app\api\controller;
use think\facade\View;
use think\facade\Db;
use think\facade\Request;

class CatView extends Base{
    public function __construct(\think\App $app)
    {
        parent::__construct($app);
    }
    public function index()
    {
        $catid=Request::param("catid",0,"intval");
        if(!$catid){
            $this->error("缺少catid或者id参数");
        }
        $cat=Db::table(config('database.connections.mysql.prefix')."cat")
            ->alias('zb')
            ->join('cat_data fb','zb.catid=fb.catid')
            ->find($catid);
        if(!$cat){
            $this->error("栏目信息不存在！");
        }
        $this->success($cat);
    }

}
